Division approximation for implantable medical devices

ABSTRACT

Methods and devices for performing division approximation in implantable and wearable self-powered medical devices. The present invention provides rapid methods for performing an approximation of division on fixed point numbers, where the methods are easily implemented in small, low power consumption devices as may be found in implantable medical devices. One example of use is in rapidly determining the approximate ratio between foreground and background activity in seizure detection algorithms. Some methods approximate the ratio of Numerator (N) to Denominator (D) by raising 2 to the power of the difference in the number of zeros to the left of the Most Significant Set Bit (MSSB) of D vs. N. Some methods may also pad bits to the right of the approximate ratio MSSB using bits from the right of the N MSSB, and/or pre-process the smaller of D or N by rounding the value upward. Methods may be implemented in firmware and/or in discrete logic.

FIELD OF THE INVENTION

The present invention is related generally to implantable medicaldevices. More specifically, the present invention is related to softwareand/or hardware methods that can be used to approximate division inimplantable medical devices.

BACKGROUND OF THE INVENTION

People in the industrialized world are living longer and healthier liveson average than previously possible. People do still become ill and fallvictim to various illnesses however. Modern medicine utilizes varioustreatments, substances, and devices for treating people. Some methodsinclude the use of implantable medical devices (IMDs). IMDs includepacemakers, cardioverters, drug pumps, neurological stimulators, andother devices well known to those skilled in the art. Some other devicesare ambulatory or wearable devices, allowing the patients to wear thedevices external to the body, but may have a lead and/or deliverycatheter implanted in the body. Examples of wearable devices includeinsulin pumps and spinal neurological devices to alleviate pain. IMDsand wearable devices have been increasingly used to treat neurologicaldisorders.

Nervous system disorders affect millions of people, causing death and adegradation of life. Nervous system disorders include disorders of thecentral nervous system, peripheral nervous system, and mental health andpsychiatric disorders. Such disorders include, for example withoutlimitation, epilepsy, Parkinson's disease, essential tremor, dystonia,and multiple sclerosis (MS). Additionally, nervous system disordersinclude mental health disorders and psychiatric disorders which alsoaffect millions of individuals and include, but are not limited to,anxiety (such as general anxiety disorder, panic disorder, phobias, posttraumatic stress disorder (PTSD), and obsessive compulsive disorder(OCD), mood disorders (such as major depression, bipolar depression, anddysthymic disorder), sleep disorders (narcolepsy), obesity, andanorexia. As an example, epilepsy is the most prevalent serious SENT VIAEXPRESS MAIL POST OFFICE TO ADDRESSEE neurological disease across allages. Epilepsy is a group of neurological conditions in which a personhas or is predisposed to recurrent seizures. A seizure is a clinicalmanifestation resulting from excessive, hypersynchronous, abnormalelectrical or neuronal activity in the brain. (A neurological event isan activity that is indicative of a nervous system disorder. A seizureis a type of a neurological event.) This electrical excitability of thebrain may be likened to an intermittent electrical overload thatmanifests with sudden, recurrent, and transient changes of mentalfunction, sensations, perceptions, and/or involuntary body movement.Because the seizures are unpredictable, epilepsy affects a person'semployability, psychosocial life, and ability to operate vehicles orpower equipment. It is a disorder that occurs in all age groups,socioeconomic classes, cultures, and countries. In developed countries,the age-adjusted incidence of recurrent unprovoked seizures ranges from24/100,000 to 53/100,000 person-years and may be even higher indeveloping countries. In developed countries, age specific incidence ishighest during the first few months of life and again after age 70. Theage-adjusted prevalence of epilepsy is 5 to 8 per 1,000 (0.5% to 0.8%)in countries where statistics are available. In the United States alone,epilepsy and seizures affect 2.3 million Americans, with approximately181,000 new cases occurring each year. It is estimated that 10% ofAmericans will experience a seizure in their lifetimes, and 3% willdevelop epilepsy by age 75.

There are various approaches in treating nervous system disorders.Treatment therapies can include any number of possible modalities aloneor in combination including, for example, electrical stimulation,magnetic stimulation, drug infusion, and/or brain temperature control.Each of these treatment modalities can be operated using closed-loopfeedback control. Such closed-loop feedback control techniques receivefrom a monitoring element a neurological signal that carries informationabout a symptom or a condition or a nervous system disorder. Such aneurological signal can include, for example, electrical signals (suchas EEG, ECOG, and/or EKG), chemical signals, other biological signals(such as change in quantity of neurotransmitters), temperature signals,pressure signals (such as blood pressure, intracranial pressure orcardiac pressure), respiration signals, heart rate signals, pH-levelsignals, and peripheral nerve signals (cuff electrodes on a peripheralnerve). Monitoring elements can include, for example, recordingelectrodes or various types of sensors.

For example, U.S. Pat. No. 5,995,868 discloses a system for theprediction, rapid detection, warning, prevention, or control of changesin activity states in the brain of a patient. Use of such a closed-loopfeed back system for treatment of a nervous system disorder may providesignificant advantages in that treatment can be delivered before theonset of the symptoms of the nervous system disorder.

In the management of a nervous system disorder, it may be important todetermine an extent of a neurological event, a location of theneurological event, a severity of the neurological event, and theoccurrence of multiple neurological events in order to provide adelivery of a treatment or otherwise manage the neurological disorder. Apatient, for example, would not benefit from a medical device system ifthe patient experienced a neurological event but was not administeredtreatment because the medical device system did not detect theneurological event. On the other hand, the patient may have adverseeffects if the patient were subjected to a degree of treatmentcorresponding to multiple neurological events, such as seizures, eventhough the patient had only one neurological event in actuality. Thefield of medical device systems in the treatment of nervous systemdisorders would benefit from methods and apparatus that determine theextent, location, severity, and time of a neurological event or aplurality of neurological events.

Algorithms, methods, and systems for seizure detection and otherneurological detection have been developed. Many such algorithms rely onmodern computers, as may be expected. Sophisticated signal processingmethods may be employed and digital signal processing (DSP) hardware maybe used. Software engineers have become accustomed to using currentlyavailable computers, having ever faster processors and ever increasingmemory. At the time of filing the present application, for example,Pentium 4 processors running at 3 GHz are not uncommon, even forpersonal use. Attempts or suggestions to shave clock cycles offalgorithms, for example division algorithms, may seem quaint andsomewhat antiquated.

Both floating point and fixed point division algorithms are commonlyused. While precision and range are certainly sacrificed, fixed pointdivision is far faster than floating point division. Take for examplethe MC68HC11 processor, a very powerful and capable single-chipmicrocontroller, used by Medtronic in some IMDs including implantableneurostimulators. A fixed point integer division takes 41 clock cycles,while a floating point division takes 2911 clock cycles in the worstcase. The fixed point routine is built into the circuitry of themicroprocessor and returns a result and a remainder value. The floatingpoint routine, being much more complicated, requires a subroutine thatis about 209 bytes in size and returns a floating value or errorindication. This subroutine further calls several other floating pointsubroutines, requiring more space, and adding 11 bytes to the stack.

Approximation of floating point division is far faster than floatingpoint division but slower or about the same as fixed point division.While again something is certainly sacrificed, approximate floatingpoint division is far faster than floating point division. This“approximation” can be done in numerous ways often involving fixed pointdivision with a number that has been shifted or multiplied up, to allowfor some precision retention at the cost of range or bit-width in fixedpoint.

In implantable medical devices, the clock speed is often severallyrestricted due to the need for long battery life in these self-powereddevices, which can be measured in years. The space available forcircuitry may also be severely limited. For these reasons, implantabledevices have often used fixed point math.

Such implantable devices may nonetheless be required to do a great dealof computation in real time. In one example, a device sampling 8electrical signals at 200 Hz, and running a detection algorithm thatinvolves division, could require that once every 200^(th) of a secondthe device needs to perform division on at least eight samples. Aseizure detection algorithm can require just such a large number ofdivisions per second. It may not even be possible to perform therequired number of divisions in the allotted time, using currentmethods, in implanted devices.

What would be desirable are methods for performing divisionapproximation that require fewer clock cycles than current implantedmedical device methods. What would be advantageous are divisionapproximation methods that can be implemented on simple microprocessorsand/or discrete logic, and that can be operated at the low powerconsumption levels most suited for implanted medical devices.

SUMMARY OF THE INVENTION

The present invention provides methods and apparatus for performingapproximation of fixed point division. These methods can be performed ina smaller number of clock cycles than conventional fixed point divisionmethods. While methods according to the present invention may not be asaccurate as conventional methods, the accuracy is suitable for manyapplications. Some embodiments of the inventions can be implemented indiscrete logic and/or in microprocessor machine code.

Embodiments of the present invention may be used in dividing numbersderived from physiological sources in determining or analyzing signal tonoise ratios. Some embodiments of the present invention can be used toperform multiple divisions per second as part of neurological seizuredetection algorithms.

One embodiment of the invention provides an apparatus and method todetermine a detection cluster that is associated with a neurologicalevent, such as a seizure, of a nervous system disorder. A set ofneurological signals, in which each neurological signal corresponds to amonitoring element, such as an electrode, is received and analyzed. Ameasure, such as a ratio that relates a short-term value to a long-termvalue, can be calculated for each neurological signal. The maximal ratiois the largest ratio for the set of neurological signals at an instanceof time. The occurrence of the detection cluster is determined when themaximal ratio exceeds an intensity threshold for at least a specificduration. If the maximal ratio drops below the intensity threshold for atime interval that is less than a time threshold and subsequently risesabove the intensity threshold, the subsequent time duration isconsidered as being associated with the same detection cluster ratherthan being associated with a different detection cluster. Consequently,treatment of the nervous system disorder during the corresponding timeperiod is in accordance with one detection cluster.

Some embodiments of the present invention provide a method for detectinga seizure in an implantable medical device (IMD) utilizing an algorithm(in one example, an Osorio-Frei type algorithm) having a plurality ofratio determinations of foreground seizure energies divided bybackground seizure energies. The method can use a ratio estimation inplace of fixed point division to determine a majority of the ratios. Theratio estimation can include estimating a Numerator (N) divided by aDenominator (D), where the estimating includes obtaining a result as afunction of 2 raised to the power of the difference between the mostsignificant set bit position (MSSB) of the D and the MSSB of the N. Somesuch methods further include setting a bit just to the right of theratio MSSB to equal the value of a bit just to the right of the N MSSB.Methods may also include first rounding up the smaller of N or D andusing the N or D in the ratio approximation. After estimating the ratio,an indication of seizure detection can be generated at least in part asa function of the ratio estimating. The indication can be a set orcleared bit or flag, a changed memory location value, or any otherchanged state, depending on the embodiment.

Some methods according to the present invention can be used to detect aseizure in an implantable medical device by obtaining a first pluralityof electrical signal samples indicative of seizure energy over a timefirst time window, and obtaining a second plurality of electrical signalsamples indicative of seizure energy over a second time window, wherethe second time window is longer in duration and extends further intothe past relative to the first window. The method can includeapproximating a ratio by raising 2 to the power of the difference inmost significant set bit positions of the first signal and the secondsignal.

Some embodiments of the present invention provide a method fordetermining a ratio approximation in a self-powered implantable orwearable medical device. The method can include obtaining a first fixedpoint number (N) indicative of a first physiological parametermeasurement, obtaining a second fixed point number (D) indicative of asecond physiological parameter measurement, and calculating the ratio ofN/D by using a method consisting essentially of raising 2 to the powerof the difference between the most significant set bit positions of thefirst number and the second number. In some such methods the first andsecond physiological parameter measurements are both derived from thesame physiological source, but the first physiological parameter isindicative of a background level and the second physiological parameteris indicative of a more recent measurement than the first. The first andsecond physiological parameters may both be derived from the same sourcebut over different time periods.

Methods according to the present invention can be used generally forperforming a division approximation of a denominator by a numerator as afunction of determining a first number of zero bits more significantthan the Most Significant Set Bit (MSSB) of the denominator, determininga second number of zero bits more significant than the numerator MSSB,and raising the difference between the first number and the secondnumber to the second power. The method of may further include filling aleast one bit to the right of the MSSB of the ratio approximation resultwith at least one corresponding bit to the right of the MSSB of thedenominator. In some methods, the smaller of the denominator ornumerator may be rounded up before being used in the ratioapproximation. In one view of some methods of the invention, determiningthe MSSB position of the numerator and/or denominator constitutes anapproximation of the numerator and/or denominator, respectively.

The present invention also includes computer readable media havingexecutable instructions for executing methods according to the presentinvention. The present invention further includes implantable andwearable medical devices having executable logic or programs within forexecuting methods according to the present invention. Some devices caninclude microprocessors executing machine code embodying a methodaccording to the present invention, other devices include discrete logicformed according to such methods, and still other devices include bothmachine code programs and discrete logic.

DESCRIPTION OF THE DRAWINGS

FIG. 1 is a front view of a neurological Implantable Medical Device(IMD) that can include the present invention;

FIG. 2 is a schematic view of one IMD for epilepsy detection that caninclude the present invention;

FIG. 3 is a flowchart of method(s) for approximating fixed pointdivision that can be executed in the IMDs of FIGS. 1 and 2; and

FIG. 4 is a plot of results for the fixed point division approximationmethods of FIG. 3.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

Approximation of fixed point division can take several forms. One choiceto replace division, to determine how much larger or smaller a potentialnumerator is than a potential denominator, is subtraction. Subtractiontakes somewhere from 2 to 7 clock cycles and doesn't require one tooperate on anything but a single number, e.g. no remainder to worryabout, and no division by zero problems. Subtraction, however does nottrack the slope of the division curve very well. That is, subtractionreally isn't that good an approximation of division, and while it mayseem comparably simple at a fraction of the clock-cycles, it's stillsomewhat complicated when it comes to having to “carry the one” and soforth.

Another way to approach approximating division is to think of thenumbers in binary; that is to think of them as a string of 1's and 0'srepresenting a value. For the purpose of this discussion we willconsider the Least Significant Bit (LSB) as the bit shown the farthestto the right. The LSB determines whether the number is even or odd. Ifthe LSB is set (1) and no other bits are set the value will be “1” indecimal numbers; if the LSB is not set (0) and no other bits are set thevalue will be zero. The next bit to the left of the LSB is the “two'splace”; for example the number “11” is 3, the number “10” is 2, and aswe know the numbers “01” and “00” are 1 and 0 respectively. We will viewthe Most Significant Bit (MSB) as the number farthest to the left. Theremay not a “left” and “right” in memory, but such descriptions makevisualizing the present invention easier.

Now it may not be apparent, but by determining how far apart the MostSignificant Set (1) Bits (MSSBs) are in a potential numerator anddenominator is a useful reflection of their ratio. The MSSB value may beviewed as the number of left shifts required to remove the MSSB from thenumber. Other views and methods are also possible. One example of usingthis approximation is given below.

If the numerator is “0000 0101” (which is 5 in decimal), the MSSB of thenumerator is 6, and the denominator is “0000 1000” (which is 8 indecimal), the MSSB of the denominator is 5. Thus we could say that theratio is approximately2ˆ(Denominator_MSSB−Numerator_MSSB)=2ˆ(5−6=)=2ˆ(−1=) 0.5. We get the −1because of the number of binary digits the MSSBs are apart and thenegative sign because the denominator MSSB is left of the numeratorMSSB. This coarse, power of two approximations, is okay and is extremelyfast, but may provide the desired quality. This and other approximationsare described below in more practical terms.

One method can include left shifting the numerator until the MSSB isdetermined by incrementing a counter, then doing the same to thedenominator.

EXAMPLE

-   MSSB—Most significant set bit-   N—numerator-   D—denominator

For example:

-   N=8=0000 1000b-   D=5=0000 0101b-   D_MSSB=5-   N_MSSB=4-   Approximate ratio=2ˆ(D_MSSB−N_MSSB)=2ˆ(5−4)=2ˆ(1)=2

Note this can also be implemented (perhaps more simply) by incrementingand decrementing the same accumulator.

For example:

-   N=12=0000 1100b-   D=5=0000 0101b

Increment the accumulator acc for each left shift required to find thenumerator MSSB then decrement the accumulator for each left shiftrequired to find the denominator MSSB.

-   acc=0+1+1+1+1+1−1−1−1−1=1    or, in the opposite order-   acc=0−1−1−1−1−1+1+1+1+1+1    Approximate ratio=2ˆ1=2

In another view of this approximation method, initialize a counter to 0.Then, starting at the Most Significant Bit (MSB) of the D, for everyleftwise bit shift required until the MSB of the D is 1, decrement thecounter. Then, starting at the Most Significant Bit (MSB) of the N, forevery leftwise bit shift required until the MSB of the N is 1, incrementthe counter. Then, a first approximation of N/D, is equal to2ˆ(counter).

For better precision, the bits following the first ratio bit can befilled in by right filling the zeros of the result of the procedureabove. This filling in may use the number of bits equal to the absolutevalue of the difference between the N_MSSB and the D_MSSB (which isstored in the result obtained above). These bits are filled in from thebits following the MSSB of the N.

For Example:

-   N=25=0001 1001b-   D=5=0000 0101b-   acc=0−1−1−1+1+1+1+1+1=2-   Approximate ratio=2ˆ2=4=100b

Note that there are 2 zero bits to the right of the MSSB of the ratioabove. These 2 zero bits may be filled by the 2 zero bits to the rightof the MSSB of the numerator. Alternatively, only 1 zero bit to theright of the MSSB of ratio may be filled. The method is referred toherein as “with filling.”

Thus, the improved Approximate ratio (with filling)=110b=6

One view of this method is described below:

Take the first ratio approximation, and, for every bit to the right ofthe MSB of the first ratio approximation, do a bitwise OR with the bitto the right of the MSSB of the D, until the LSB of the first ratioapproximation has been bitwise ORed.

To further improve the division, a “round-up” scheme could be used basedon the numerator and/or most significant not used bit of thedenominator. The round up can be based on the smaller of N or D. Thisround can be done to pre-process the smaller of the N or D, before usingthe N and D in the ratio approximation. This scheme is referred to hereas “with rounding”. One way of rounding a number in binary is to add 1to the bit to the right of the MSSB.

For example:

-   N=96=0110 0000b-   D=15=0000 1111b-   acc=0−1+1+1+1+1=3-   Approximate ratio=2ˆ(5−2)=2ˆ3=8=1000b-   Improved Approximate ratio (with filling)=1100b=12

Further Improved ratio (with filling and rounding):

-   First round up D, which is the smaller of N and D, from 00001111 b    to 00010000b-   Then acc=0−1+1+1+1=2-   Then Approximate ratio (with rounding)=2ˆ(4−2)=2ˆ2=4=100b-   Then Improved Approximate ratio (with filling)=110b=6

FIG. 1 shows an embodiment of an implanted system 20 for treatmentand/or detection of a nervous system disorder in accordance with oneembodiment of the invention. As discussed, although the implanted system20 is discussed in the context of providing brain stimulation, it willbe appreciated that the implanted system 20 may also be used to provideother treatment therapies at the brain or head or at other locations ofthe body. The implanted system 22 generally includes an implanted device22 coupled to one or more therapy delivery elements 24 through a lead orcatheter 26. The therapy delivery elements 24, of course, may also serveas monitoring elements to receive a neurological signal. The implanteddevice 22 may continuously or intermittently communicate with anexternal programmer (e.g., patient or physician programmer) viatelemetry using, for example, radio-frequency signals. In thisembodiment, each of the features and functionalities discussed hereinare provided by the implanted device 20.

Those skilled in the art will appreciate that the self-powered medicaldevice systems described herein may take any number of forms from beingfully implanted to being mostly external or wearable and can providetreatment therapy to neural tissue in any number of locations in thebody. Some embodiments are wearable, ambulatory systems, having acatheter and/or lead attached onto or into the body of wearer, allowingfree movement. The implantable or wearable systems are self-powered,relying on a portable power source, allowing for free movement, but nothaving unlimited power available to support computationally expensivealgorithms. For example, the medical device systems described herein maybe utilized to provide vagal nerve stimulation, for example, asdisclosed in U.S. Pat. No. 6,341,236 (Osorio, et al.). In addition, thetreatment therapy being provided by the medical device systems may varyand can include, for example, electrical stimulation, magneticstimulation, drug infusion, and/or brain temperature control (e.g.,cooling). Moreover, it will be appreciated that the medical devicesystems may be utilized to analyze and treat any number of nervoussystem disorders. For example, various U.S. patents assigned toMedtronic provide example of nervous system disorders that can betreated. In the event that closed-loop feedback control is provided, themedical device system can be configured to receive any number ofneurological signals that carry information about a symptom or acondition or a nervous system disorder. Such signals may be providedusing one or more monitoring elements such as monitoring electrodes orsensors. For example, U.S. Pat. No. 6,227,203, assigned to Medtronic,Inc., provides examples of various types of sensors that may be used todetect a symptom or a condition or a nervous system disorder andresponsively generate a neurological signal and is incorporated hereinin its entirety.

Referring again to FIG. 1, leads 26 can be coupled at a distal end toelectrodes that sense brain activity of the patient and deliverelectrical stimulation to the patient. At a proximal end, leads 26 canbe coupled to implantable device 22. The connection between leads 26typically occurs under the scalp on top of the cranium at a convenientlocation such as behind and above the ear. An external device, forexample, an external wearable digital signal processing unit, may alsobe coupled to IMD 22 to receive sampled signals from the implantabledevice 22, detects seizures, and send signals to the implantable device22 to initiate stimulation therapy.

FIG. 2 is a schematic block diagram of one implantable device 50, thatcan be used as or part of IMD 22 of FIG. 1. Implantable device 50 isimplanted in conjunction with a set of electrodes 51. In someembodiments, the set of electrodes 51 comprises eight electrodes. Areference electrode 53 is another electrode that is not included in theset of electrodes 51 and is not typically as involved with theneurological activity as the set of electrodes 51. The apparatus 50 maycommunicate with an external device through a telemetry transceiver 77through an antenna 75, and a telemetry link 73. External devices maycollect data from the apparatus 50 by placing a patch antenna on thepatient's body over the implantable device to thereby communicate withantenna 75 of apparatus 50.

Each electrode of the set of electrodes 51 may either receive aneurological signal or may stimulate surrounding tissue. Stimulation ofany of the electrodes contained in the electrode set 51 is generated bya stimulation IC 55, as instructed by a microprocessor 69.Microprocessor 69 can be clocked by oscillator 71 and coupled to anaddress/data bus represented at 67. Bus 67 can be coupled to controlregisters 59 which can in turn be coupled to other components previouslydescribed. When stimulation is generated through an electrode, theelectrode is blanked by a blanking circuit 57 so that a neurologicalsignal is not received by channel electronics (e.g., amplifier 61). Whenmicrocontroller 69 determines that a channel shall be able to receive aneurological signal, an analog to digital converter (ADC) 63 samples theneurological signal at a desired rate (e.g., 250 times per second). Thedigitized neurological signal may be stored in a waveform memory 65 sothat the neurological data may be retrieved by the apparatus 50 wheninstructed. In particular, a program for evaluating the signals storedin memory 65 may be executed by micro-controller 69. Digital logic 79can be coupled to control registers 59, ADC 63, and waveform memory 65in some embodiments. Digital logic 79 can execute at least some of themethods according to the invention in some embodiments.

While device 50 is illustrated as discrete components, the actual devicemay be implemented as a hybrid device, built of discrete digital logic.In particular, some or all of microprocessor 69 may be implemented usingdiscrete logic.

FIG. 3 is a flowchart that illustrates methods 100 that can be used toimplement the present invention. Such methods can, for example, beexecuted by micro-processor 69. FIG. 3 will be used to introduce themethods in general, at a high level, with more detailed and specificexamples provided in the text that follows. At least 4 methods areillustrated in FIG. 3, as the first and last steps are optional, andtherefore at least four combinations are provided by using no optionalsteps, the first, the last, or both the first and the last steps.

Methods 100 can be used to determine an approximate ratio R of anumerator N divided by a denominator D. By “fixed point”, the presentapplication refers to both signed and unsigned integers that may beinterpreted as having implied scaling or fractional power of two bitpositions. The most significant bit in an eight bit number may represent128, 64, 1/2, etc. As used herein, the “most significant set bit” (MSSB)refers to the most significant bit set in the portion of the word thatdoes not represent sign information.

Step 102 is optional, and may not be present in some embodiments. Instep 102, the smaller of either the denominator (D) or the numerator (N)is preprocessed to round up the number. The optional step is referred toas “with rounding.” A method according to the present invention canbegin with either step 102 or 104.

One method of rounding is to add 1 to the bit position just to the rightof the MSSB.

Step 104 begins with the value of D, either the original D or the resultof rounding determined and stored in D_MSSB. The bit position of themost significant set bit (MSSB) in D indicates the magnitude of D.D_MSSB may be determined by counting the number of zeros to the left ofthe MSSB of D. The value of D may be bit shifted left to determine thisvalue. In implementation, discrete logic may be used to rapidlydetermine the MSSB.

Step 106 is similar to step 104. In step 106, the MSSB is determined forN, and stored in N_MSSB. N_MSSB is an indication of relative magnitudeof N. Again, N may be the original N or N after preprocessing by step102.

In step 108, the approximate ratio R is determined by raising 2 to thepower of the difference between N_MSSB and D_MSSB. In some methods, thevalue of R obtained from step 108 is used as the approximate ratio. Inother methods, step 110 is used to post-process the ratio R. It may benoted that the result of step 108 will have only one significant bit.

In step 110, another significant bit or bits may be added to the resultof step 108. In some methods, where M is chosen to be 1, then the bit tothe right of the MSSB in R is set to have the value of the MSSB of N. Inother methods, where M is greater than 1, more than 1 bit of R is set tobe equal to the corresponding bits of N. This aspect of the invention isreferred to as “filling.”

FIG. 4 illustrates a set of results 200 for division approximation usingthe present invention. The X-axis varies the denominator from 3 to 18and varies the numerator repeatedly from 0 to 255 for each denominator.The Y-axis shows the various results. The denomination range of 3 to 18is of particular interest for a seizure detection algorithm. Keep inmind that for more ready threshold applications or use with otherimplementations, the number of bits of input and the y-scale of theoutputs can be easily gained/bit-shifted.

The true ratio is shown at 206. The result for subtraction is shown at202. As can be seen, this is not scaled, as the subtraction valuesrepeat themselves over the entire range of denominators. The results forthe MSBR Ratio may be seen at 210. This is the basic algorithm, nothaving rounding or filling. This has a stair step shape, which hasdiscontinuities, but tends to bracket the true ratio, both high and low.In some applications, this step function may not bee appropriate. Inother applications, the good on-average accuracy may be useful. Theresults for MSB Ratio rounded may be seen at 212. This is the methodhaving the smaller of the numerator or denominator rounded up prior tothe MSSB determinations. The Fill Bigger method is shown at 204, havingthe basic method plus the bit filling with 1 bit to the right. This doesnot have the stair step shape of the basic algorithm at 210, but is alsofurther away from the true ratio 206 on average. The MSB Ratio Roundedand Filled result may be seen at 208, having the smaller of thedenominator or numerator rounded up, followed by the basic algorithm,followed by filling 1 bit to the right. This may be seen to undershootthe true ratio 206 rather than bracket it as with MSB Ratio 210, but itlacks the stair step shape, and is closer on average than either the MSBRounded 212 or MSB fill bigger 204. The various approximation methodsmay be used in various applications. These methods provideapproximations to the true ratios that are much faster to compute thanthe true ratio calculations for fixed point numbers.

Thus, embodiments of implantable and wearable medical devices configuredfor division approximation are disclosed that can provide more rapidcalculation of approximate ratios. One skilled in the art willappreciate that the present invention can be practiced with embodimentsother than those disclosed. The disclosed embodiments are presented forpurposes of illustration and not limitation, and the present inventionis limited only by the claims that follow.

1. A method for detecting a seizure in an implantable or wearablemedical device (IMD), the method comprising: executing an algorithmhaving a plurality of ratio determinations of foreground seizureenergies divided by background seizure energies, in which the algorithmuses a ratio estimation in place of fixed point division to determine amajority of the ratios, wherein the ratio estimation includes estimatinga Numerator (N) divided by a Denominator (D); and generating anindication of a detected seizure at least in part as a function of theratio determinations.
 2. The method of claim 1, in which the ratioestimation includes estimating the Numerator.
 3. The method of claim 1,in which the ratio estimating includes estimating the Denominator. 4.The method of claim 1, in which the ratio estimating includes estimatingthe Numerator and the Denominator.
 5. The method of claim 1, in whichthe estimating includes obtaining a result as a function of 2 raised tothe power of the difference between the most significant set bitposition (MSSB) of the D and the MSSB of the N.
 6. The method of claim5, in which the ratio result of claim 1 has a MSSB, further comprisingsetting a bit just to the right of the ratio MSSB to equal the value ofa bit just to the right of the N MSSB.
 7. The method of claim 5, inwhich the ratio result of claim 5 has a MSSB, further comprising settinga number of M bits to the right of the ratio MSSB to have the value asthe same number of M bits just to the right of the N MSSB.
 8. The methodof claim 7, in which M has a value of at least
 1. 9. The method of claim7, in which M is equal to all bits to the right of the MSSB of the ratioresult of claim
 7. 10. The method of claim 5, in which the smaller ofthe N or the D is first processed by rounding up the smaller of the N orthe D, and the rounded up number is used in the method of claim
 5. 11.The method of claim 7, in which the smaller of the N or the D is firstprocessed by rounding up the smaller of the N or the D, and the roundedup number is used in the method of claim
 5. 12. A computer readablemedium having computer executable instructions for executing the methodof claim
 1. 13. A self-powered implantable or wearable medical devicehaving executable instructions or logic for executing the method ofclaim
 1. 14. A method for detecting a seizure in an implantable orwearable medical device, the method comprising: obtaining a firstplurality of electrical signal samples indicative of seizure energy overa time first time window; obtaining a second plurality of electricalsignal samples indicative of seizure energy over a second time window,wherein the second time window is longer in duration and extends furtherinto the past relative to the first window; approximating a ratio of afirst average of the first window values divided by a second average ofthe second window values; and generating an indication of the seizure atleast in part as a function of the ratio approximations.
 15. The methodof claim 14, in which the ratio approximating includes estimating theNumerator.
 16. The method of claim 14, in which the ratio approximatingincludes estimating the Denominator.
 17. The method of claim 14, inwhich the ratio approximating includes estimating the Numerator and theDenominator.
 18. The method of claim 14, in which the ratioapproximating includes raising 2 to the power of the difference in mostsignificant set bit positions of the first signal and the second signal.19. The method of claim 18, wherein the ratio result of claim 18 has aMSSB, further comprising setting a number of M bits to the right of theratio MSSB to have the value as the same number of bits M just to theright of the N MSSB.
 20. The method of claim 19, in which M has a valueof at least
 1. 21. The method of claim 18, in which the smaller of the Nor the D is first processed by rounding up the smaller of the N or theD, and the rounded up number is used in the method of claim
 18. 22. Themethod of claim 19, in which the smaller of the N or the D is firstprocessed by rounding up the smaller of the N or the D, and the roundedup number is used in the method of claim
 18. 23. A self-poweredimplantable or wearable medical device having executable instructions orlogic for executing the method of claim
 18. 24. A method for determininga physiological measurement ratio in a self powered Implantable MedicalDevice (IMD) or a self-powered wearable medical device the methodcomprising: obtaining a first signal indicative of a first physiologicalmeasurement, wherein the first signal is represented in a first fixedpoint number; obtaining a second signal indicative of a secondphysiological measurement, wherein the second signal is represented in asecond fixed point number; and determining a ratio approximation of aratio of the first number divided by the second number.
 25. The methodof claim 24, in which the ratio approximation determining includesestimating the first fixed point number.
 26. The method of claim 24, inwhich the ratio approximation determining includes estimating the secondfixed point number.
 27. The method of claim 24, in which the ratioapproximation determining includes estimating the first and second fixedpoint numbers.
 28. The method of claim 24, in which the ratioapproximation determining includes raising 2 to the power of thedifference in most significant set bit positions between the firstnumber and the second number.
 29. The method of claim 29, in which thefirst number is an average over a first time period and in which thesecond number is an average over a second time period, where the fisttime period is shorter than the second time period, wherein the firstand second signals are both derived from a common signal source.
 30. Themethod of claim 29, in which the first time period is more recent thanthe second time period.
 31. The method of claim 29, in which the firstnumber is indicative of brain neurological activity extending back afirst period, and in which the second number is indicative of averageneurological activity extending back a second time period that is longerthan the first time period.
 32. The method of claim 28, in which thefirst number is indicative of a physiological signal and in which thesecond number is indicative of physiological noise, and in which theratio is a signal to noise ratio.
 33. A computer readable medium havingcomputer executable instructions for executing the method of claim 28.34. A self-powered implantable or wearable medical device havingexecutable instructions or logic for executing the method of claim 28.35. A method for determining at least an approximate ratio between anumerator (N) and a denominator (D), both having most significant setbits (MSSBs), as least in part as a function of a method, the methodcomprising: estimating the ratio as 2 raised to the power of thedifference between the number of zeros to the left of the MSSB in the Dand the number of zeros to the left of the MSSB in the N.
 36. The methodof claim 35, wherein the ratio result of claim 35 has a MSSB, furthercomprising setting a bit just to the right of the ratio MSSB to equalthe value of a bit just to the right of the N MSSB.
 37. The method ofclaim 35, wherein the ratio result of claim 35 has a MSSB, furthercomprising setting a number of M bits to the right of the ratio MSSB tohave the value of the same number of bits M just to the right of the NMSSB.
 38. The method of claim 37, in which M has a value of at least 1.39. The method of claim 37, in which M is equal to the number of allbits to right of the MSSB of the ratio result of claim
 37. 40. Themethod of claim 35, in which the smaller of the N or the D is processedby rounding up the smaller of the N or the D, and the rounded up numberis used in the method of claim
 35. 41. The method of claim 37, in whichthe smaller of the N or the D is first processed by rounding up thesmaller of the N or the D, and the rounded up number is used in themethod of claim
 35. 42. A computer readable medium having computerexecutable instructions for executing the method of claim
 35. 43. Aself-powered implantable or wearable medical device having executableinstructions or logic for executing the method of claim
 35. 44. A methodfor performing a division approximation of a denominator by a numeratorto obtain a result, the method comprising: determining the result as afunction of a first number of zero bits more significant than the MostSignificant Set Bit (MSSB) of the denominator and a second number ofzero bits more significant than the numerator MSSB, including raisingthe difference between the first number and the second number to thesecond power.
 45. The method of claim 44, further comprising filling aleast one bit to the right of the MSSB of the claim 44 result with atleast one corresponding bit to the right of the MSSB of the denominator.46. The method of claim 45, in which the determining consistsessentially of the steps of claim
 44. 47. A computer readable mediumhaving computer executable instructions for executing the method ofclaim
 44. 48. A method for determining a ratio approximation in aself-powered implantable or wearable medical device, the methodcomprising: obtaining a first fixed point number (N) indicative of afirst physiological parameter measurement; obtaining a second fixedpoint number (D) indicative of a second physiological parametermeasurement; and calculating the ratio approximation of N/D by using amethod consisting essentially of raising 2 to the power of thedifference in most significant set bit positions between the firstnumber and the second number.
 49. The method of claim 48, in which thefirst and second physiological parameter measurements are both derivedfrom the same physiological source, but where the first physiologicalparameter is indicative of a background level and the secondphysiological parameter is indicative of a more recent measurement thanthe first.
 50. The method of claim 48, in which the first and secondphysiological parameters are both derived from the same source but overdifferent time periods.
 51. A computer readable medium having computerexecutable instructions for executing the method of claim
 48. 52. Aself-powered implantable or wearable medical device having executableinstructions or logic for executing the method of claim
 48. 53. A methodfor determining an approximate ratio of a foreground seizure energydivided by a background seizure energy in a seizure detectioncalculation in a self powered implantable or wearable medical device,the method comprising: obtaining a first fixed point number (N)indicative of the foreground seizure energy; obtaining a second fixedpoint number (D) indicative of the background seizure energy; andcalculating an approximate ratio of N/D by using a method consistingessentially of raising 2 to the power of the difference in mostsignificant set bit positions between the first number and the secondnumber.
 54. The method of claim 53, in which the method consistsessentially of the steps of claim
 53. 55. An implantable medical devicehaving a processor executing the method of claim
 53. 56. A wearablemedical device having a processor executing the method of claim
 53. 57.A computer readable medium having computer executable instructions forexecuting the method of claim
 53. 58. A computer readable medium havingcomputer executable instructions for executing the method of claim 54.